<style>
    .ly-tip-box {
        margin-top: 10px;
    }
</style>
<template>
    <ly-page>
        <ly-navi title="loading"></ly-navi>
        <ly-page-content>
            <el-divider content-position="left">loadingbar</el-divider>
            <div>
                <el-button @click="showBar('start')" type="primary" size="small">开始</el-button>
                <el-button @click="showBar('end')" type="primary" size="small">结束</el-button>
                <el-button @click="showBar('error')" type="primary" size="small">错误</el-button>
            </div>
            <ly-code-view>
                <pre v-pre>
App.$loadingbar.start();
App.$loadingbar.end();
App.$loadingbar.error();
            </pre>
            </ly-code-view>


            <el-divider content-position="left">锁定提交按钮</el-divider>
            <div>
                <el-button @click="save" :loading="posting.loading" type="primary" size="small">提交</el-button>
            </div>
            <ly-code-view>
                <div v-pre>
定义
posting:{}
按钮
 < el-button  :loading="posting.loading"  type="primary" size="small" >提交< /el-button>
网络请求
axios.post('/course/api/v1/class/getList',{},{loading_bar:true,loading:this.posting});
                </pre>
                </div>
           </ly-code-view>

            <el-divider content-position="left">锁定屏幕</el-divider>
            <div>
                <el-button @click="save2" type="primary" size="small">提交</el-button>
                <el-button @click="save2('欢乐的敲着代码')" type="primary" size="small">自定义文案</el-button>
            </div>
            <ly-code-view>
                <div v-pre>
默认
 axios.post('/course/api/v1/class/getList',{},{lock:true});
自定义文案
axios.post('/course/api/v1/class/getList',{},{lock:'欢乐的敲着代码'});
                </pre>
                </div>
            </ly-code-view>



        </ly-page-content>

    </ly-page>
</template>
<script>
    Rap.define("", [], function () {
        return {
            data: function () {
                return {
                    size: 2,
                    count: 8,
                    posting: {}
                }
            },
            mounted: function () {
//
            },
            methods: {
                showBar: function (type) {
                    if (type == 'start') {
                        App.$loadingbar.start();
                    } else if (type == 'end') {
                        App.$loadingbar.end();
                    } else if (type == 'error') {
                        App.$loadingbar.error();
                    }

                }, save: function () {
                    axios.post('/course/api/v1/class/getList', {}, {loading_bar: true, loading: this.posting});
                }, save2: function (text) {
                    if (!text) {
                        text = true;
                    }
                    axios.post('/course/api/v1/class/getList', {}, {lock: text});
                }

            }
        }
    })
</script>